// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

import { ObscuredInt } from "./ObscuredInt";

const {ccclass, property} = cc._decorator;
//antiCheat 反修改作弊int 使用案例
@ccclass
export default class antiExample extends cc.Component {


    m_label:cc.Label;
    m_atk:ObscuredInt;//伤害属性

    onLoad () {
        this.m_label = this.node.getComponent(cc.Label);
        this.m_atk = new ObscuredInt(100);
        this.incrementScore(5000);
    }

    // 增加玩家分数
    incrementScore(points: number): void {
        let newScore = this.m_atk.getDecrypted() + points;
        this.m_atk = new ObscuredInt(newScore);
    }

    start () {

    }

    update (dt) {
        this.m_label.string = this.m_atk.getDecrypted().toString();

    }
}
